<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        var x = 214;
        var num = 0;
        
        if(x<= -Math.pow(2,31)||x>=Math.pow(2,31)||num==0){
            num = 0
        }
        while(x!=0){
            num = num*10+x%10;
            x =parseInt(x/10) 
            
        }
        console.log(num);
        
    </script>
</body>
</html>